﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo1
{
    class Program1
    {
        static void Main(string[] args)
        {
            Animal cat = new Cat(1,4);
            Animal tiger = new Tiger(1,4);
            Animal eagle = new Eagle(2,2);
            Animal yanzi = new Yanzi(2,2);
            cat.Eat();
            Console.WriteLine();
            tiger.Eat();
            Console.WriteLine();
            eagle.Eat();
            Console.WriteLine();
            yanzi.Eat();
            Console.WriteLine();
            ((Cat)cat).Action();
            Console.WriteLine();
            ((Tiger)tiger).Action();
            Console.WriteLine();
            ((Eagle)eagle).Action();
            Console.WriteLine();
            ((Yanzi)yanzi).Action();
        }
    }

    abstract class Animal
    {
        private int leg;

        public int Leg { get => leg; set => leg = value; }

        protected Animal(int leg)
        {
            Leg = leg;
        }
        public Animal()
        {

        }

        public abstract void Eat();
        public abstract void Sleep();
        public abstract void Voice();
    }

    interface IBird
    {
        void fly();
    }
    interface IMaoKe
    {
        void MaoBu();
    }

    abstract class Bird : Animal, IBird
    {
        private int wings;

        public int Wings { get => wings; set => wings = value; }

        protected Bird(int wings,int legs) : base(legs)
        {
            this.wings = wings;
        }
        public Bird()
        {

        }

        public abstract void fly();
    }

    abstract class MaoKe : Animal, IMaoKe
    {
        private int Weiba;

        public int Weiba1 { get => Weiba; set => Weiba = value; }

        protected MaoKe(int weiba,int legs) : base(legs)
        {
            Weiba = weiba;
        }
        public MaoKe()
        {

        }
        public abstract void MaoBu();
    }

    class Tiger : MaoKe
    {
        public Tiger(int weiba,int leg) : base(weiba,leg)
        {

        }
        public override void Eat()
        {
            Console.WriteLine("Tiger is eating");
        }

        public override void MaoBu()
        {
            Console.WriteLine("老虎在走猫步");
        }

        public override void Sleep()
        {
            Console.WriteLine("Tiger is sleeping");
        }

        public override void Voice()
        {
            Console.WriteLine("ao! ao!");
        }

        public void Kill()
        {
            Console.WriteLine("Tigew is killing");
        }

        public void Action()
        {
            Eat();
            MaoBu();
            Sleep();
            Voice();
            Kill();
        }
    }

    class Cat : MaoKe
    {
        public Cat(int weiba, int leg) : base(weiba, leg)
        {

        }
        public override void Eat()
        {
            Console.WriteLine("Cat is eating");
        }

        public override void MaoBu()
        {
            Console.WriteLine("猫在走猫步");
        }

        public override void Sleep()
        {
            Console.WriteLine("cat is sleeping");
        }

        public override void Voice()
        {
            Console.WriteLine("miao!!");
        }
        public void Action()
        {
            Eat();
            MaoBu();
            Sleep();
            Voice();
        }
    }
    class Yanzi : Bird
    {
        public Yanzi(int wings, int legs) : base(wings, legs)
        {

        }
        public override void Eat()
        {
            Console.WriteLine("Yanzi is Eating");
        }

        public override void fly()
        {
            Console.WriteLine("Yanzi is flying");
        }

        public override void Sleep()
        {
            Console.WriteLine("Yanzi is sleeping");
        }

        public override void Voice()
        {
            Console.WriteLine("Yanzi si singing");
        }
        public void Action()
        {
            Eat();
            fly();
            Sleep();
            Voice();
        }
    }
    class Eagle : Bird
    {
        public Eagle(int wings,int legs) : base(wings,legs)
        {

        }
        public override void Eat()
        {
            Console.WriteLine("eagle is eating!");
        }

        public override void fly()
        {
            Console.WriteLine("eagle is flying");
        }

        public override void Sleep()
        {
            Console.WriteLine("eagle is sleepign");
        }

        public override void Voice()
        {
            Console.WriteLine("ying ying ying");
        }

        public void Action()
        {
            Eat();
            fly();
            Sleep();
            Voice();
        }
        
    }
}
